# from selenium.webdriver.support.ui import Select
#  s = Select(webElement)
# select_by_value
# select_by_index
# select_by_visable_text
# deselect_all

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from changliang import LUJING
import time
from selenium.webdriver.support.ui import Select

wd = webdriver.Chrome(service=Service(LUJING))
wd.implicitly_wait(10)
wd.get('https://www.byhy.net/cdn2/files/selenium/test2.html')

# radio 
ele =wd.find_element(By.CSS_SELECTOR,'#s_radio input[checked]')
print(ele.get_attribute('value'))

wd.find_element(By.CSS_SELECTOR,'#s_radio input[value="小江老师"]').click()

# input
ele = wd.find_elements(By.CSS_SELECTOR,'#s_checkbox input[checked]')
for i in ele:
    print(i.get_attribute('value'))
    i.click()
wd.find_element(By.CSS_SELECTOR,'#s_checkbox input[value="小雷老师"]').click()

#select 
s = Select(wd.find_element(By.CSS_SELECTOR,'#ss_single'))
s.deselect_all
s.select_by_index(1)

ss = Select(wd.find_element(By.CSS_SELECTOR,'#ss_multi'))
ss.deselect_all
ss.select_by_visible_text('小江老师')
ss.select_by_visible_text('小凯老师')

time.sleep(10)